﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net.Mail;
/// <summary>
/// Summary description for sendmail
/// </summary>
public class sendmail
{
	public sendmail()
	{
	}
    public int Send(string fromMail,string password,string toMail,string subject,string noidung)
    {
        MailMessage mail = new MailMessage();
        SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
        mail.From = new MailAddress(fromMail);
        mail.To.Add(toMail);
        mail.Subject = subject;
        mail.Body = noidung;
        SmtpServer.Port = 587;
        SmtpServer.Credentials = new System.Net.NetworkCredential(fromMail, password);
        SmtpServer.EnableSsl = true;
        SmtpServer.Send(mail);
        return 1;
    }
}